<?php

class Userv2info_model extends Base_Model
{
    const TABLE = 'user_v2_userinfo';

    public function __construct()
    {
        $this->load->database();
    }

    /**
     * 获取信息
     *
     * @param $data
     * @return mixed
     */
    public function getUserV2Info($data)
    {
        $this->db->select(
                           'uvu.userFamily,
                           uvu.userName,
                           uvu.userGender,
                           u.telCode,
                           u.userId,
                           uvu.introduction,
                           uvu.userAge,
                           uvu.nationality,
                           uvu.resideCity,
                           uvu.resideTime,
                           u.userIcon'
                          )
                 ->from('user_v2_userinfo as uvu');
        $this->db->join('user_v2 as u', 'u.uid = uvu.uid', 'left');
        $this->db->where($data);

        return $this->db->get()->row_array();
    }

    /**
     *
     * 修改会员信息
     * @param $data
     * @param $where
     * @return CI_DB_active_record|CI_DB_result
     */
    public function editUserInfo($data, $where)
    {
        return $this->db->update(self::TABLE, $data, $where);
    }
    /**
     * 创建userv2_info
     *
     * @param $data
     * @return int
     */
    public function createUserV2Info($data)
    {
        $this->db->insert(self::TABLE, $data);
        return $this->db->insert_id();
    }

}